<template>
    <p>{{setVal}}</p>
</template>
<script>
export default {
  props: {
    rawData: Array | String,
    field: String,
    type: String
  },
  methods: {},
  computed: {
    setVal() {
      var val = "";

      if (this.type == "date") {
        if (this.rawData[this.field]) {
          val = timestampToTime(this.rawData[this.field]);
        }
      } else {
        if (isArray(this.rawData)) {
          if (isNoEmpty(this.rawData)) {
            for (let i = 0; i < this.rawData.length; i++) {
              if (i == this.rawData.length - 1) {
                val += this.rawData[i][this.field];
              } else {
                val += this.rawData[i][this.field] + ",";
              }
            }
          }
        } else {
          val = getValueByKey(this.field, this.rawData);
        }
      }

      return val;
    }
  },
  mounted() {
  }
};
</script>
